from django.urls import path
from blog import views
from django.views.decorators.cache import cache_page

app_name = 'blog'
urlpatterns = [
    # 首页和所有文章页面缓存30分钟,按需设置
    # path('', cache_page(60 * 30)(views.IndexView.as_view()), name='index'),
    # path('all/', cache_page(60 * 15)(views.AllView.as_view()), name='all'),
    path('', views.IndexView.as_view(), name='index'),
    path('all/', views.AllView.as_view(), name='all'),
    path('article/<int:pk>/', views.ArticleView.as_view(), name='article'),
    path('tag/<tag>/', views.TagView.as_view(), name='tag'),
    path('category/<category>/', views.CategoryView.as_view(), name='category'),
    path('search/', views.SearchView.as_view(), name='search'),
    path('comment/<article_id>/', views.CommentPostView.as_view(), name='comment'),
]
